<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>BoardGame 3000: GameState Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">BoardGame 3000
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">A simple board game structure</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a>  </div>
  <div class="headertitle">
<div class="title">GameState Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Class that holds information and methods for current game.  
 <a href="class_game_state.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_game_state_8h_source.html">GameState.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for GameState:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_game_state.png" usemap="#GameState_map" alt=""/>
  <map id="GameState_map" name="GameState_map">
<area href="class_breakthrough_game_state.html" alt="BreakthroughGameState" shape="rect" coords="0,56,148,80"/>
<area href="class_mini_break_game_state.html" alt="MiniBreakGameState" shape="rect" coords="158,56,306,80"/>
</map>
 </div></div>

<p><a href="class_game_state-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a4fa0a2bf50315c4a35a3890a0adcee5c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#a4fa0a2bf50315c4a35a3890a0adcee5c">GameState</a> ()</td></tr>
<tr class="memitem:ae623df5042cd0c17daa3394fdcb397b3"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#ae623df5042cd0c17daa3394fdcb397b3">~GameState</a> ()</td></tr>
<tr class="memitem:ab007218d35a0bf9937d3f2c87746ce20"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#ab007218d35a0bf9937d3f2c87746ce20">startState</a> (std::vector&lt; std::vector&lt; char &gt; &gt; &amp;grid)</td></tr>
<tr class="memitem:a489b12b8118076f860c780558c8b1677"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#a489b12b8118076f860c780558c8b1677">movePiece</a> (std::vector&lt; std::vector&lt; char &gt; &gt; &amp;grid, int fromX, int fromY, int toX, int toY)</td></tr>
<tr class="memitem:a32fe3fad0d7a15ca057618300a14cfa4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#a32fe3fad0d7a15ca057618300a14cfa4">getNumMoves</a> ()</td></tr>
<tr class="memitem:aa09b5a00d8c7beb6538db8e1f50c88e9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#aa09b5a00d8c7beb6538db8e1f50c88e9">printPieces</a> ()</td></tr>
<tr class="memitem:aca1c9a6ff69dc682d8c630ca3d3172fd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#aca1c9a6ff69dc682d8c630ca3d3172fd">retract</a> (std::vector&lt; std::vector&lt; char &gt; &gt; &amp;grid)</td></tr>
<tr class="memitem:af8164df269dc4912c1bfbdb267e74abd"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#af8164df269dc4912c1bfbdb267e74abd">getEvaluation</a> ()</td></tr>
<tr class="memitem:a378f64d867f5908c1e6b54da06f8319c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#a378f64d867f5908c1e6b54da06f8319c">getCurrentPlayer</a> ()</td></tr>
<tr class="memitem:a479924ca9f0d1cedb410031a7c37497c"><td class="memItemLeft" align="right" valign="top">std::vector&lt; <a class="el" href="struct_move.html">Move</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#a479924ca9f0d1cedb410031a7c37497c">getLegalMoves</a> (std::vector&lt; std::vector&lt; char &gt; &gt; &amp;grid)</td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:adf3a0cdd022c7cf1fae65c8fabb8efa1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adf3a0cdd022c7cf1fae65c8fabb8efa1"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#adf3a0cdd022c7cf1fae65c8fabb8efa1">m_currentPlayer</a></td></tr>
<tr class="memdesc:adf3a0cdd022c7cf1fae65c8fabb8efa1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Current player. <br/></td></tr>
<tr class="memitem:a16dc97fd4b9b9c6729f08590b9b7e54d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a16dc97fd4b9b9c6729f08590b9b7e54d"></a>
<a class="el" href="class_player.html">Player</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#a16dc97fd4b9b9c6729f08590b9b7e54d">m_players</a></td></tr>
<tr class="memdesc:a16dc97fd4b9b9c6729f08590b9b7e54d"><td class="mdescLeft">&#160;</td><td class="mdescRight">The players which are playing. <br/></td></tr>
<tr class="memitem:a50ae0c3fb4e3e021a98859077f566381"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a50ae0c3fb4e3e021a98859077f566381"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#a50ae0c3fb4e3e021a98859077f566381">m_numMoves</a></td></tr>
<tr class="memdesc:a50ae0c3fb4e3e021a98859077f566381"><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of moves made. <br/></td></tr>
<tr class="memitem:ab788865506dd4b9f095becb61a3c8f2f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab788865506dd4b9f095becb61a3c8f2f"></a>
<a class="el" href="struct_move.html">Move</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_game_state.html#ab788865506dd4b9f095becb61a3c8f2f">m_moves</a></td></tr>
<tr class="memdesc:ab788865506dd4b9f095becb61a3c8f2f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Last move made. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Class that holds information and methods for current game. </p>
<p><a class="el" href="class_game_state.html" title="Class that holds information and methods for current game.">GameState</a> is a baseclass which is inheritated by your own YOURGAMEGameState.h. There you have to implement <a class="el" href="class_game_state.html#ab007218d35a0bf9937d3f2c87746ce20">startState()</a>, <a class="el" href="class_game_state.html#a479924ca9f0d1cedb410031a7c37497c">getLegalMoves()</a>, <a class="el" href="class_game_state.html#a489b12b8118076f860c780558c8b1677">movePiece()</a> Your Derived class also have to have a member variable of the type YOURGAMERules (ex.. <a class="el" href="class_breakthrough_rules.html">BreakthroughRules</a> m_rules;) </p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a4fa0a2bf50315c4a35a3890a0adcee5c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_game_state.html#a4fa0a2bf50315c4a35a3890a0adcee5c">GameState::GameState</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Empty constructor </p>

</div>
</div>
<a class="anchor" id="ae623df5042cd0c17daa3394fdcb397b3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_game_state.html#ae623df5042cd0c17daa3394fdcb397b3">GameState::~GameState</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Virtual destructor </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a378f64d867f5908c1e6b54da06f8319c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="class_game_state.html#a378f64d867f5908c1e6b54da06f8319c">GameState::getCurrentPlayer</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Returns the current <a class="el" href="class_player.html" title="One Player on board Player for the game.">Player</a> </p>

</div>
</div>
<a class="anchor" id="af8164df269dc4912c1bfbdb267e74abd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="class_game_state.html#af8164df269dc4912c1bfbdb267e74abd">GameState::getEvaluation</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Evaluates the current gamestate </p>

</div>
</div>
<a class="anchor" id="a479924ca9f0d1cedb410031a7c37497c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;<a class="el" href="struct_move.html">Move</a>&gt; <a class="el" href="class_game_state.html#a479924ca9f0d1cedb410031a7c37497c">GameState::getLegalMoves</a> </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; std::vector&lt; char &gt; &gt; &amp;&#160;</td>
          <td class="paramname"><em>grid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Returns all legal moves possible from current position </p>

<p>Reimplemented in <a class="el" href="class_breakthrough_game_state.html#a5f619c254d555cf93ca0dce681e3a34e">BreakthroughGameState</a>.</p>

</div>
</div>
<a class="anchor" id="a32fe3fad0d7a15ca057618300a14cfa4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="class_game_state.html#a32fe3fad0d7a15ca057618300a14cfa4">GameState::getNumMoves</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Returns number of moves made </p>

</div>
</div>
<a class="anchor" id="a489b12b8118076f860c780558c8b1677"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_game_state.html#a489b12b8118076f860c780558c8b1677">GameState::movePiece</a> </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; std::vector&lt; char &gt; &gt; &amp;&#160;</td>
          <td class="paramname"><em>grid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>fromX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>fromY</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>toX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>toY</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Moves piece from one location to another. Your implementation should call the isLegal() function in your Rules class, and then call the MovePiece() funcion in Gamestate if legal. </p>

<p>Reimplemented in <a class="el" href="class_breakthrough_game_state.html#ac2123455056b223327b4542081f898d9">BreakthroughGameState</a>, and <a class="el" href="class_mini_break_game_state.html#ad25fcdfaef91c410465459905dc4748e">MiniBreakGameState</a>.</p>

</div>
</div>
<a class="anchor" id="aa09b5a00d8c7beb6538db8e1f50c88e9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_game_state.html#aa09b5a00d8c7beb6538db8e1f50c88e9">GameState::printPieces</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Prints out number of pieces for each player </p>

</div>
</div>
<a class="anchor" id="aca1c9a6ff69dc682d8c630ca3d3172fd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_game_state.html#aca1c9a6ff69dc682d8c630ca3d3172fd">GameState::retract</a> </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; std::vector&lt; char &gt; &gt; &amp;&#160;</td>
          <td class="paramname"><em>grid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Retract the last move played takes the grid for the board as argument </p>

</div>
</div>
<a class="anchor" id="ab007218d35a0bf9937d3f2c87746ce20"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_game_state.html#ab007218d35a0bf9937d3f2c87746ce20">GameState::startState</a> </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; std::vector&lt; char &gt; &gt; &amp;&#160;</td>
          <td class="paramname"><em>grid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Initilize the board and players Your implementations should call the <a class="el" href="class_game_state.html#a4fa0a2bf50315c4a35a3890a0adcee5c">GameState()</a> constructor and then initPlayers in your rules class. </p>

<p>Reimplemented in <a class="el" href="class_breakthrough_game_state.html#a48b42c69bcefeecd2604c41fbda11a95">BreakthroughGameState</a>, and <a class="el" href="class_mini_break_game_state.html#a00f7e33986a4022d2298ae1c1099e4ff">MiniBreakGameState</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="_game_state_8h_source.html">GameState.h</a></li>
<li>GameState.cpp</li>
</ul>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Sat May 12 2012 15:22:53 for BoardGame 3000 by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
